﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AlbumViewer.aspx.cs" Inherits="AlbumViewer"  Title="Photo.RU" culture="auto" meta:resourcekey="PageResource1" uiculture="auto" MaintainScrollPositionOnPostback="True" %>
<%@ Register TagPrefix="Custom" Namespace="ImageTable" Assembly = "ImageTable" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div>
        <asp:HyperLink ID="hplHome" runat="server" text="На главную" SkinID="albums" 
            meta:resourcekey="hplHome"></asp:HyperLink>
        &nbsp;<asp:ScriptManager ID="ScriptManager" runat="server">
        </asp:ScriptManager>

    </div>
    <div class="centerAlignment">
        <asp:Label ID="LabelAlbumInfo" runat="server" SkinID="labelalbumname" Text="Название альбома" 
            meta:resourcekey="LabelAlbumInfoResource1"></asp:Label>
    </div>
    <div>
        <asp:Label ID="lblAuthor" runat="server" SkinID="labelauthor" Text="Кто загрузил"></asp:Label>
            &nbsp;&nbsp;
        <asp:Label ID="lblDate" runat="server" SkinID="labelauthor" Text="Дата загрузки"></asp:Label>
            &nbsp;&nbsp;
        <asp:Button ID="btnShowEdPan" runat="server" onclick="btnShowEdPan_Click" meta:resourcekey="btnShowEdPan"
            Text="Show Edit Panel" Visible="False" SkinID="btnsmall" />
        <asp:Button ID="btnHideEdPan" runat="server" onclick="btnHideEdPan_Click" meta:resourcekey="btnHideEdPan"
            Text="Hide Edit Panel" Visible="False" SkinID="btnsmall" />
        <br />
        <asp:Button ID="btnDelAlbum" runat="server" meta:resourcekey="btnDelAlbum" onclick="btnDelAlbum_Click" onclientclick="return ConfirmAction()" Text="Delete Album" Visible="false" />
        <asp:Button ID="btnDelImage" runat="server" meta:resourcekey="btnDelImage" 
            Text="Delete Images" Visible="False" onclick="btnDelImage_Click" onclientclick="return ConfirmAction()" />
        <asp:Button ID="btnChanAlName" runat="server" onclick="btnNewAlName_Click" 
             meta:resourcekey="btnChanAlName"
            Text="Change Album Name" Visible="False" />
        <asp:Button ID="btnUploadImage" runat="server" onclick="btnUploadImage_Click" 
            meta:resourcekey="btnUploadImage" Text="Upload Images" Visible="False" />
        <asp:Button ID="btnSendEmail" runat="server" Text="Send e-mail" 
            meta:resourcekey="btnSendEmail" onclick="btnSendEmail_Click" Visible="False"/>
        <br />
        <asp:Label ID="lblPhotosOnPage" runat="server" Text="Photos on page" 
            meta:resourcekey="lblPhotosOnPage" SkinID="labelauthor"></asp:Label>
        <asp:DropDownList ID="ImagesPerPageDdlist" runat="server" AutoPostBack="True" 
            onselectedindexchanged="ImagesPerPageDdlist_SelectedIndexChanged">
            <asp:ListItem Value="5">5</asp:ListItem>
            <asp:ListItem Value="10">10</asp:ListItem>
            <asp:ListItem Value="50">50</asp:ListItem>
            <asp:ListItem Value="0" Text="all" meta:resourcekey="lstItemAll"></asp:ListItem>
        </asp:DropDownList>
        <br />
        <div class="centerAlignment">
            <asp:ImageButton ID="btnBack" runat="server" SkinID="back" 
                onclick="btnBack_Click" />
            <asp:ImageButton ID="btnForward" runat="server" SkinID="forward" 
                onclick="btnForward_Click"/>
        </div>
    </div>
    <div class="centerAlignment">
        <script type="text/javascript" language="javascript">
            function ConfirmAction()
            {
                return confirm('<%= GetLocalResourceObject("Confirm") %>');
            }  
        </script> 

        <script type="text/javascript" language="javascript">
            function DisplayNewImageInWidnow() 
            {
                var imgsource = document.getElementById('<%= CurrentImageToView.ClientID %>').src;

                html = "<HTML><HEAD><TITLE>Photo</TITLE>"
                + "</HEAD><BODY LEFTMARGIN=0 "
                + "MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER>"
                + "<IMG src='"
                + imgsource
                + "' BORDER=0 NAME=image "
                //+ "onload='window.resizeTo(document.image.width,document.image.height)'>"
                + "onload='window.resizeTo(screen.width,screen.height)'>"
                + "</CENTER>"
                + "</BODY></HTML>";
                popup = window.open('', 'image', 'toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1');
                popup.document.open();
                popup.document.write(html);
                popup.document.focus();
                popup.document.close();
            } 
        </script>

        <asp:UpdatePanel ID="UpdatePanel" runat="server">
            <ContentTemplate>
                <asp:Image ID="CurrentImageToView" runat="server" 
                    meta:resourcekey="currentImage" style="cursor:pointer" SkinID="photo" onclick="DisplayNewImageInWidnow();" />
                <br />
                <br />
                <asp:Label ID="lblAlbumIsEmpty" runat="server" SkinID="labelalbumname" Text="" meta:resourcekey="lblAlbumIsEmpty" Visible="false"></asp:Label>
                <br />
               
                <br />
                <div class="centerAlignment">
                    <Custom:ImageTable ID="ImgTable"  runat="server" OnPictureChanged="ImageTable_Updated"/>
                </div>
                <div class="leftAlignment">
                 <asp:Label ID="lblPages" runat="server" meta:resourcekey="lblPages" Width="100%"></asp:Label>
                    <asp:Menu ID="mnuPagesList" runat="server" Orientation="Horizontal" 
                        onmenuitemclick="mnuPagesList_MenuItemClick" Width="100%">
                    <StaticSelectedStyle Font-Underline="True" />
                    </asp:Menu>
                </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnBack" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="btnForward" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="ImagesPerPageDdlist" EventName="SelectedIndexChanged" />
                <asp:AsyncPostBackTrigger ControlID="mnuPagesList" EventName="MenuItemClick" />
            </Triggers>
        </asp:UpdatePanel>

    </div> 
</asp:Content>



